import { createRouter,createWebHashHistory } from 'vue-router'
import Layout from '@/views/layout/index.vue'
import Home from '@/views/home/index.vue'
import MessageBoard from '@/views/messageBoard/index.vue'
import MultiDevice from '@/views/multiDevice/index.vue'
import Dashboard from '@/views/dashboard/index.vue'
import Login from '@/views/login/index.vue'
import NotFound from '@/views/404/index.vue'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: Layout,
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'home',
          component: Home,
        },
        {
          path: '/message-board',
          name: 'MessageBoard',
          component: MessageBoard
        },
        {
          path: '/multi-device',
          name: 'MultiDevice',
          component: MultiDevice,
        },
        {
          path: '/dashboard',
          name: 'dashboard',
          component: Dashboard,
          meta: { login: true },
        },
        {
          path: '/login',
          name: 'login',
          component: Login,
        },
        {
          path: '/:pathMatch(.*)*',
          name: 'NotFound',
          component: NotFound,
        },
      ]
    }
  ],
})

export default router
